Fault diagnosis of rolling bearings using convolutional neural network (CNN) has great significance for maintaining the performance and guaranteeing the healthy operation of the rotating machinery. However, some deficiencies exist in fault diagnosis based on convolutional neural network, because the sampled actual vibration data are often differently distributed and difficult to label. In order to solve this problem, a fault diagnosis method of rolling bearing based on one-dimensional convolutional neural network with transfer learning is proposed. Firstly, a one-dimensional convolutional neural network model which can directly process vibration signals is established and pre-trained with the data in source domain. Then, maximum mean discrepancy (MMD) is used to measure the feature distribution distance between the source domain and the target domain in each layer of the pre-training model and determine whether the convolutional layers and fully-connected layers can be transferred, and after that the model is restructured through the initialization strategy. Finally, a small number of labeled data in target domain are used to train the model again, and then the fault data in target domain are classified. The effectiveness of the proposed method is verified by processing the bearing fault data, and the obtained results show that the proposed method can realize the accurate fault classification of rolling bearings under variable operation conditions while there are only a few labeled data in the target domain.